<%--
 *  File:   FileListRuleSummary.jsp
 *  Desc:	
 *
 *  Date	  :	 2010/07/22     		    
 *  Author	:  kenfang		 
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "E0513";
  String strTableName = "v_columnmappingrule";
  String strModuleName = "CM";
  String contextPath = request.getContextPath(); 

%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
	<%@ include file="/inc/Security.inc" %>

<%
    String strIsTdr = null;
    if(request.getParameter("istdr")!=null&&request.getParameter("istdr").length()!=0)
        strIsTdr=request.getParameter("istdr");
%>
	
<html>
<head>
<title>FilListRuleSummary</title>
<PageFlow:CheckPageFlow pageName="p_columnmappingrule"/>
<%@ include file="/inc/SumDiv.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "FileListRuleSummary.jsp?istdr=<%= strIsTdr %>&<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.columnmappingruleid.value = obj;
}
function page_detail(obj,idx){
	self.location.href='FileListRuleFrm.jsp?<%= OvalTools.randomURL() %>&flag=new&columnmappingruleid='+obj;
}

function page_new()
{
	self.location.href='FileListRuleFrm.jsp?<%= OvalTools.randomURL() %>&flag=new';
}
function page_delete()
{
	var cform = document.cform;
	var id = cform.columnmappingruleid.value;
	if(isEmpty(id) || id == -1) return;
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	cform.actionname.value="delete";
	isRunning = true;
    cform.submit();
}
function page_confirm()
{
  var cform = document.cform;
	var id = cform.columnmappingruleid.value;

	if(isEmpty(id) || id == -1) return;
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	cform.actionname.value="confirm";
	isRunning = true;
    cform.submit();
}
function page_edit()
{
	var cform = document.cform;
	var id = cform.columnmappingruleid.value;
	if(isEmpty(id) || id == -1) return;
	
	    self.location.href='FileListRuleFrm.jsp?<%= OvalTools.randomURL() %>&columnmappingruleid='+id+"&flag=edit";
}
function page_info(id)
{
var cform = document.cform;
    	//var id = cform.fileruleconfigid.value;
    self.location.href='FileListRuleFrm.jsp?<%= OvalTools.randomURL() %>&columnmappingruleid='+id+"&flag=view";
}
</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_columnmappingrule">
    <input type="hidden" name="actionname">
    

<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>

    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          
          <table width="100%" border="0" cellspacing="0">
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
      </tr>
      <tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
			<tr  class="deepblue-left"> 
	            <td width="4%" class="title_center">&nbsp;</td>
	            <td class="title_center"><a href="javascript:page_summary('orderby','columnmappingrulecode')"><%= label.getLabelName("L_ColumnMappingCode") %></a></td>
	            <td width="18%" class="title_center"><a href="javascript:page_summary('orderby','columnmappingrulename')"><%= label.getLabelName("L_ColumnMappingName") %></a></td>
	            <td width="18%" class="title_center"><a href="javascript:page_summary('orderby','filedatatype')"><%= label.getLabelName("L_TransType") %></a></td>
	            <td width="18%" class="title_center"><a href="javascript:page_summary('orderby','workflowname')"><%= label.getLabelName("L_WorkflowName") %></a></td>
	            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','isstander')"><%= label.getLabelName("L_IsStander") %></a></td>
	         </tr>
	         <%
             int j = 0;
             String strClassType = new String(); 
             Integer nDefaultPeriodId = new Integer(-1);  
             boolean bHasChecked = false;
             Vector rulessummary = (Vector)pageContext.getAttribute("rulessummary");
             if(rulessummary == null) rulessummary = new Vector();
             int nDefaultColumnmappingruleid = -1;
             
             //4reload the checked period
             Integer periodid = (Integer)pageContext.getAttribute("periodid");
          %>
          <logic:iterate id="summary" collection="<%= rulessummary %>">                      
         <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            String strIsChecked = "";
            if(j%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
            
            if(j == 0){
            	strIsChecked = "Checked"; 
            	if(summaryMap.get("columnmappingruleid") != null){
            		nDefaultColumnmappingruleid = ((Integer)summaryMap.get("columnmappingruleid")).intValue();
            	}
            	
            }
            
	              
            j++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('radio<%=JspHelper.filterNull(j)%>');clickRow('<custom:write property="columnmappingruleid" name="summary"/>','<%=j + "" %>')" class="<%=JspHelper.filterNull(strClassType)%>">
            <td>
              <input class="normalradio" id="radio<%=JspHelper.filterNull(j )%>" type="radio" name="columnmappingruleidradio" value="<custom:write property="columnmappingruleid" name="summary"/>" <%=JspHelper.filterNull( strIsChecked)%>>
            </td>
            <td>&nbsp;<A onclick="page_info('<custom:write property="columnmappingruleid" name="summary"/>')"><custom:write property="columnmappingrulecode" name="summary"/></A></td>
            <td>&nbsp;<custom:write property="columnmappingrulename" name="summary"/></td>
            <td>&nbsp;<custom:write property="filedatatype" name="summary" nbsp="true" dictType="DataCleanType"/></td>
            <td>&nbsp;<custom:write property="workflowname" name="summary"/></td>
            <td class="td_center">&nbsp;<custom:write property="isstander" name="summary"/></td>
          </tr>
          </logic:iterate>
          <%//---------------set default value-------------------- %>
          <input type="hidden" name="columnmappingruleid" value="<%=JspHelper.filterNull( nDefaultColumnmappingruleid )%>">
          <input type="hidden" name="rownum" value="1">
            <%@ include file="/inc/SummaryAction.inc" %>
          </table>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
             
                <a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
              <%
                  if(pageContext.getAttribute("rulessummary")!=null){
              %>
                <a onclick="page_edit();"><custom:button type="1" label="L_Edit" imgsrc="Modify.gif" border="0" style="width:60"/></a>
				<%if(privilegeSet != null && privilegeSet.contains("B6100")){%> 
                <a onclick="page_delete();"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
				<%}%>
              <%}%>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>
</html>